package pers.zw.study.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "ServletFilterDemo1", urlPatterns = "/ServletFilterDemo1")
public class ServletFilterDemo1 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String method = request.getMethod();
        String name = request.getParameter("username");

        PrintWriter out = response.getWriter();
        out.write("请求的方式：" + method);
        out.write("<br/>");
        out.write("接收的参数：" + name);

    }
}
